import serial
import time
import binascii

if __name__ == '__main__':
    ser = serial.Serial(0, 1200, timeout=2)  # open first serial port
    print ser

    while (1):
        frame = ser.read(500)
        l = len(frame)
        if l:
            print 'recv',  len(frame), binascii.b2a_hex(frame) 
        else:
            print 'recv',  len(frame)
        
    print 'end'